<template>
   <div class="cartlist">
     <cart-list-item  v-for="(item,index) in acountLength" :key="index" :item="item" :counter="counter(index)"></cart-list-item>
   </div>
</template>

<script>
  import CartListItem from "./CartListItem";
  import {mapGetters} from "vuex"
  export default {
    name: "CartList",
    components:{
      CartListItem
    },
    computed:{
      //获取数组
      ...mapGetters(["acountLength"]),
      counter(){
         return function(index){
             return parseInt(this.$store.state.productlist[index].count)
         }
      }
    },


  }
</script>

<style scoped>


</style>
